﻿//-----------------------------------------------------------------------
// <copyright>
//     Copyright (c) Artur Mustafin. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------

namespace Excel.Expressions.Compiler
{

    using Classes;

    internal class CellReference : CellExpression
    {
        private Cell _cell;

        /// <summary>
        /// Gets the id.
        /// </summary>
        /// <value>The id.</value>
        public int Id
        {
            get
            {
                return _cell.Id;
            }
        }

        public CellReference(int row, int col)
        {
            _cell = Cell.GetCell(row, col);
        }

#if DEBUG
        public override string ToString()
        {
            return _cell.ToString();
        }
#endif

        public bool HasExpression
        {
            get
            {
                return _cell.HasExpression;
            }
        }

        public override double Eval()
        {
            _cell.Eval();
            return _cell.Double;
        }

        public Cell Cell
        {
            get
            {
                return _cell;
            }
        }
    }
}
